#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>


int cmp(const void* a, const void* b)
{
    return *(int*)a > *(int*)b;
}
int arrayPairSum(int* nums, int numsSize) {
    qsort(nums, numsSize, sizeof(int), cmp);
    int sum = 0;
    for (int i = 0; i < numsSize; i += 2)
    {
        sum += nums[i];
    }
    return sum;
}